package com.flow.dao.impl;

import java.util.ArrayList;
import java.util.List;
import com.flow.dao.IUserRoleDao;
import com.flow.model.PagerModel;
import com.flow.model.UserRole;

public class UserRoleDao<T> extends BaseDao<T> implements IUserRoleDao<T> {

	@Override
	public boolean insertUserRole(UserRole userRole) {

		try {

			insert(userRole);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}

		return false;
		
	}

	@Override
	public boolean updateUserRole(UserRole userRole) {
		
		try {

			update(userRole);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		
		return false;
		
	}

	@Override
	public boolean deleteUserRole(UserRole userRole) {
		
		try {

			delete(userRole);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		
		return false;
		
	}

	@Override
	public UserRole findUserRoleByHql(String hql) {

		return findUserRoleByHql(hql, null);
		
	}

	@Override
	public UserRole findUserRoleByHql(String hql, Object param) {

		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return findUserRoleByHql(hql, params);
		
	}

	@Override
	public UserRole findUserRoleByHql(String hql, List<Object> params) {
		
		return (UserRole) findByHql(hql, params);
		
	}

	@Override
	public int universalMethodUserRole(String hql) {

		return universalMethodUserRole(hql, null);
		
	}

	@Override
	public int universalMethodUserRole(String hql, Object param) {

		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return universalMethodUserRole(hql, params);
		
	}

	@Override
	public int universalMethodUserRole(String hql, List<Object> params) {

		return universalMethod(hql, params);
		
	}

	@Override
	public List<T> findUserRoleAllByHql(String hql) {

		return findUserRoleAllByHql(hql, null);
		
	}

	@Override
	public List<T> findUserRoleAllByHql(String hql, Object param) {

		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return findUserRoleAllByHql(hql, params);
		
	}

	@Override
	public List<T> findUserRoleAllByHql(String hql, List<Object> params) {

		return findAllByHql(hql, params);
		
	}

	@Override
	public PagerModel findUserRolePagerModeled(PagerModel pager, String hql) {
		
		return findUserRolePagerModeled(pager, hql, null);
		
	}

	@Override
	public PagerModel findUserRolePagerModeled(PagerModel pager, String hql, Object param) {
		
		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return findUserRolePagerModeled(pager, hql, params);
		
	}

	@Override
	public PagerModel findUserRolePagerModeled(PagerModel pager, String hql, List<Object> params) {

		return findPagerModeled(pager, hql, params);
		
	}
}
